package com.LiL.Wayne.Activity.SlidingMenu;

import java.io.IOException;
import java.util.List;

import twitter4j.User;
import android.app.ListFragment;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.LiL.Wayne.Activity.R;
import com.LiL.Wayne.Activity.fragment.MainContainerActivity;
import com.LiL.Wayne.Activity.fragment.MainContainerActivityTest;
import com.audamob.audasingers.model.SlidingMenuListItem;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;

/**
 * @author Andrius Baruckis http://www.baruckis.com
 * 
 *         List fragment, which will be used as a content for sliding out menu.
 * 
 */
public class SlidingMenuListFragment extends ListFragment implements
		OnClickListener {
	protected List<SlidingMenuListItem> slidingMenuList;
	private SlidingMenuBuilderBase slidingMenuBuilderBase;
	SlidingMenu menu;
     
	public SlidingMenuListFragment(SlidingMenu menu) {
		// TODO Auto-generated constructor stub
		this.menu = menu;
	}

	public void setMenuBuilder(SlidingMenuBuilderBase slidingMenuBuilderBase) {
		this.slidingMenuBuilderBase = slidingMenuBuilderBase;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// We set here a custom layout which uses holo light theme colors.
		View SlidingMenuLayout = inflater.inflate(R.layout.auda_layout_sliding_menu,
				null);

		return SlidingMenuLayout;

	}

	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);

		UI_CreateMenuListView();
	}

	
	public void UI_CreateMenuListView() {
		RelativeLayout ItemMenu_1, ItemMenu_2, ItemMenu_3, ItemMenu_4, ItemMenu_5,ItemMenu_6,ItemMenu_7;
		ItemMenu_1 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_1);
		ItemMenu_2 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_2);
		ItemMenu_3 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_3);
		ItemMenu_4 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_4);
		ItemMenu_5 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_5);
		ItemMenu_6 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_6);
		ItemMenu_7 = (RelativeLayout) getActivity().findViewById(
				R.id.ItemMenu_7);
		ItemMenu_1.setOnClickListener(this);
		ItemMenu_2.setOnClickListener(this);
		ItemMenu_3.setOnClickListener(this);
		ItemMenu_4.setOnClickListener(this);
		ItemMenu_5.setOnClickListener(this);
		ItemMenu_6.setOnClickListener(this);
		ItemMenu_7.setOnClickListener(this);

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.ItemMenu_1:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_1);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_VIDEOS);
			menu.toggle();
			return;

		case R.id.ItemMenu_2:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_2);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_MUSICS);
			menu.toggle();
			break;
		case R.id.ItemMenu_3:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_3);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_LYRICS);
			menu.toggle();
			return;

		case R.id.ItemMenu_4:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_4);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_NEWS);
			menu.toggle();
			return;

		case R.id.ItemMenu_5:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_5);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_TWEETS);
			menu.toggle();
			return;
			
		case R.id.ItemMenu_6:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_6);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_BIO);
			menu.toggle();
			return;
		case R.id.ItemMenu_7:
			UpdateUiSelecor();
			ActifSelector(R.id.selector_7);
			MainContainerActivityTest.ChangeCurrentFragment(MainContainerActivityTest.ITEM_SETTINGS);
			menu.toggle();
			return;
		default:
			break;
		}
	}

	public void ActifSelector(int Rid) {
		getActivity().findViewById(Rid).setVisibility(View.VISIBLE);
	}

	public void UpdateUiSelecor() {
		RelativeLayout s1, s2, s3, s4, s5,s6,s7;
		s1 = (RelativeLayout) getActivity().findViewById(R.id.selector_1);
		s2 = (RelativeLayout) getActivity().findViewById(R.id.selector_2);
		s3 = (RelativeLayout) getActivity().findViewById(R.id.selector_3);
		s4 = (RelativeLayout) getActivity().findViewById(R.id.selector_4);
		s5 = (RelativeLayout) getActivity().findViewById(R.id.selector_5);
		s6 = (RelativeLayout) getActivity().findViewById(R.id.selector_6);
		s7 = (RelativeLayout) getActivity().findViewById(R.id.selector_7);

		s1.setVisibility(View.INVISIBLE);
		s2.setVisibility(View.INVISIBLE);
		s3.setVisibility(View.INVISIBLE);
		s4.setVisibility(View.INVISIBLE);
		s5.setVisibility(View.INVISIBLE);
		s6.setVisibility(View.INVISIBLE);
		s7.setVisibility(View.INVISIBLE);
	}

	

	

}
